#ifndef __triac_h
#define __triac_h

//Hal------------------
#define F_triacOn()   P2_0 = 0
#define F_triacOff()  P2_0 = 1
#define D_crossZero   P3_7 
//Const-----------------
#define D_triacHoldTime   5 //base 0.125ms 
#define D_watt 16

#define D_0W 0
#define D_100W 2
#define D_150W 3
#define D_200W 4
#define D_300W 6
#define D_400W 8
#define D_450W 9
#define D_500W 10
#define D_600W 12
#define D_700W 14
#define D_800W 16
// //Var-----------------
	#ifdef __triac_c
	uint8_t data holdWatt;
		uint8_t data TriacLastTimer;
		bit data bLastZero ;
		bit data bZero ;
	//	bit bDelay ;
		bit data bWattSetted ;
	//	bit	bAlarm ;	
	uint8_t data holdFireType;
		uint8_t data fireType ;
		uint8_t data triacTimer  ;
		//uint8_t zeroCounter ;
		 uint8_t  data fireTypeNum;
 bit data triacOn2ms;
 bit data triacOn1ms;
	  uint8_t data startZero;
	#else
	extern uint8_t  data fireTypeNum;
extern bit data triacOn2ms;
extern bit data triacOn1ms;
	 extern uint8_t data  startZero;
		extern uint8_t data holdFireType;
		extern 	uint8_t data  holdWatt;
		extern 	uint8_t data TriacLastTimer;

		extern bit data bLastZero ;
		extern bit data bZero ;
		//extern bit bDelay ;
		extern bit data bWattSetted ;
		//extern bit	bAlarm ;
		extern uint8_t data fireType ;
		extern uint8_t data triacTimer  ;	
		//extern uint8_t zeroCounter ;
	#endif
//Function-------------------
void InitTriac() ;


#endif
